﻿function login() {
    $("#login_btn").click(function (event) {
        // 阻止默认事件
        event.preventDefault()
        var username = $("input[name='username']").val()
        var password = $("input[name='password']").val()
        $.ajax({
            url: '/user/login',
            data: {
                username: username,
                password: password
            },
            method: 'post',
            success: function (result) {
                console.log(result)
            }
        })
    });
}


// 整个网页加载完再去执行函数
$(function () {
    login()

});